Featherweight Java with dynamic and static overloading

نویسندگان

  • Lorenzo Bettini
  • Sara Capecchi
  • Betti Venneri
چکیده

We propose FMJ (Featherweight Multi Java), an extension of Featherweight Java with encapsulated multi-methods thus providing dynamic overloading. Multi-methods (collections of overloaded methods associated to the same message, whose selection takes place dynamically instead of statically as in standard overloading) are a useful and flexible mechanism which enhances re-usability and separation of responsibilities. However, many mainstream languages, such as, e.g., Java, do not provide it, resorting to only static overloading. The proposed extension is conservative and type safe: both “message-not-understood” and “message-ambiguous” are statically ruled out. Possible ambiguities are checked during type checking only on method invocation expressions, without requiring to inspect all the classes of a program. A static annotation with type information guarantees that in a welltyped program no ambiguity can raise at run-time. This annotation mechanism also permits modeling static overloading in a smooth way. Our core language can be used as the formal basis for an actual implementation of dynamic (and static) overloading in Java-like languages.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

A Safe Implementation of Dynamic Overloading in Java-Like Languages

We present a general technique for extending Java-like languages with dynamic overloading, where method selection depends on the dynamic type of the parameter, instead of just the receiver. To this aim we use a core Java-language enriched with encapsulated multi-methods and dynamic overloading. Then we define an algorithm which translates programs to standard Java code using only basic mechanis...

متن کامل

PPPJ special issue-Foreword

Originally established in 2002 in Kilkenny, Ireland, the Principles and Practice of Programming in Java (PPPJ) conference series has been held 2003 in Dublin (Ireland), 2004 in Las Vegas (USA), 2006 in Mannheim (Germany), 2007 in Monte de Caparica–Lisbon (Portugal), and 2008 in Modena (Italy). The conference has experienced a steady growth in participation because it is a lively forum for leadi...

متن کامل

Object Incompleteness and Dynamic Composition in Java-Like Languages

Object composition is often advocated as a more flexible alternative to standard class inheritance since it takes place at run-time, thus permitting to specialize the behavior of objects dynamically. In this paper we present Incomplete Featherweight Java (IFJ), an extension of Featherweight Java to incomplete objects, i.e., objects that require some missing methods which can be provided at run-...

متن کامل

Featherweight TeX and Parser Correctness

TEX (and its LTEX incarnation) is a widely used document preparation system for technical and scientific documents. At the same time, TEX is also an unusual programming language with a quite powerful macro system. Despite the wide range of TEX users (especially in the scientific community), and despite a widely perceived considerable level of “pain” in using TEX, there is almost no research on ...

متن کامل

Featherweight Wrap Java: wrapping objects and methods

We present a language extension, which integrates in a Java like language a mechanism for dynamically extending object behaviors without changing their type. Our approach consists in moving the addition of new features from class (static) level to object (dynamic) level: the basic features of entities (representing their structure) are separated from the additional ones (wrapper classes whose i...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:
  • Sci. Comput. Program.

دوره 74  شماره 

صفحات  -

تاریخ انتشار 2009